package top.yuki.event;

import org.bukkit.World;
import org.bukkit.WorldCreator;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.LivingEntity;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.world.WorldInitEvent;
import top.yuki.LevelWorld;
import top.yuki.data.DataManager;
import top.yuki.data.DayDataManager;
import top.yuki.data.TempDataManage;
import top.yuki.data.WorldManage;



public class onCreateWorld implements Listener {
    public DataManager dataManage;
    private TempDataManage tempDataManage;
    private DayDataManager dayDataManager;
    private WorldManage worldManage;
    private ConfigurationSection config;

    public onCreateWorld(LevelWorld lw) {
        this.dataManage = lw.dataManage;
        this.tempDataManage = lw.tempDataManage;
        this.dayDataManager = lw.dayDataManager;
        this.worldManage = lw.worldManage;
        this.config = lw.getConfig();
    }

    @EventHandler
    public void onCreateWorld(WorldInitEvent e) {
        World world = e.getWorld();
        String name =world.getName();
        if (worldManage.existWorld(name)) {
            worldManage.changeUUID(name,world.getUID());
        }else{
            worldManage.setWorld(world.getUID(),world.getName(),0);
        }
        world.setGameRuleValue("keepInventory","true");
        world.setGameRuleValue("doFireTick","false");



    }

}